<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: zzz
  Date: 2020/2/7
  Time: 11:19
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>登录</title>
    <link rel="stylesheet" type="text/css" href="${APP_PATH}/portal/css/public.css"/>
    <link rel="stylesheet" type="text/css" href="${APP_PATH}/portal/css/login.css"/>
</head>
<body>
<c:if test="${not empty cookie.uname}">
    <c:redirect url="/user/toCookieLogin">
        <c:param name="uname" value="${cookie.uname.value}"></c:param>
        <c:param name="upass" value="${cookie.upass.value}"></c:param>
    </c:redirect>
</c:if>
<!-------------------login-------------------------->
<div class="login">
    <form action="${APP_PATH}/user/toLogin" method="post">
        <h1><a href="${APP_PATH}/toPortal"><img src="${APP_PATH}/portal/img/temp/logo.png"></a></h1>
        <p></p>
        <div id="msg" class="msg-warn hide"><b></b>${requestScope.msg == null ? "公共场所不建议自动登录，以防账号丢失" : requestScope.msg}</div>
        <p><input type="text" id="uname" name="uname" value="" placeholder="昵称/邮箱/手机号"></p>
        <p><input type="text" id="upass" name="upass" value="" placeholder="密码"></p>
        <p><input type="submit" name="" value="登  录" onclick="return validation()"></p>
        <p class="txt"><span><input type="checkbox" style="width: 5px; vertical-align: middle;" name="cookie" value="true" />自动登录</span><a href="${APP_PATH}/toRegister">免费注册</a><a href="${APP_PATH}/toPortal">返回首页</a></p>
    </form>
</div>

</body>
</html>
<script src="${APP_PATH}/portal/js/jquery-1.12.4.min.js" type="text/javascript" charset="utf-8"></script>
<script>

    function validation() {
        var flag = true;
        if($("#uname").val() == "" || $("#upass").val() == ""){
            flag = false;
            $("#msg").html("<b></b>账号密码不能为空！");
        }
        return flag;
    }
    </script>